class SiteController < ApplicationController
    
  verify :method => :post, :only => [:search, :upload]
  
  def jobs
    @sectors = Sector.find(:all, :include => :jobs)
  end
  
  def rss
    @vacancies = Job.find(:all)
    render :layout => false
  end
  
  def sitemap
    @root_url = "http://#{`hostname`.chop}/"
    @jobs = Job.find(:all)
    @pages = Comatose::Page.find(:all)
    render :layout => false
  end
  
  def upload
    render :text => '<h1>Thank you for your submission.</h1>', :layout => 'site' if Notifier.deliver_uploaded_cv(params[:cv])
  rescue
    render :text => '<h1>Something went wrong</h1> <p>Maybe you entered your details incorrectly?</p> <p>At a minimum we need your name, email address and a copy of your CV.</p>', :layout => 'site'
  end
  
  def view
    @job = Job.find(params[:id])
  end
  
  def viewsector
    @jobs = Job.find(:all, :conditions => {:sector_id => params[:id], :visible => false})
  end
end